<script setup lang='ts'>
  import { onMounted, reactive } from 'vue';
  import { luckDrawApi } from '@/api/controller';
  import { Toastloading } from '@/utils/public';
  import Pagination from "@/components/Pagination/index.vue";
  const action = reactive({
    total:0,
    list:[] as any[],
  })
  const listQuery = reactive({
    page:1,
    limit:20,
  })
  const getList = async()=> {
    const loading = Toastloading()
    const res = await luckDrawApi.get_defender_draw()
    loading.close()
    const { data=[], total=0, } = res?.data || {}
    action.total = total
    action.list = data
  }
  onMounted(()=>{
    getList()
  })
</script>

<template>
  <div class="xm-content">
    <el-table
      class="xm-main xm-TableCenter"
      :data="action.list"
      border
    >
      <el-table-column width="100" prop="id" label="活动ID" />
      <el-table-column min-width="120" prop="name" label="活动名称" />
      <el-table-column width="120" prop="price" label="活动价格" />
      <el-table-column min-width="150" prop="tag" label="标签" />
      <el-table-column min-width="120" prop="start" label="开始时间" />
      <el-table-column min-width="120" prop="end" label="结束时间" />
    </el-table>
    <Pagination v-show="action.total > 0" :total="action.total" v-model:page="listQuery.page"
      v-model:limit="listQuery.limit" @pagination="getList" />
  </div>
</template>
